#include "Level2.h"

Level2::Level2(void)
{
}

Level2::~Level2(void)
{
}

void Level2::InitLevel(Character *player, QUESTTYPE questType, int difficulty)
{
	if(!init){
		// FIRST FLOOR //

		//Base floor
		this->CreatePlatform(Vector3D(-210, 500, 0), 14, 1, Platform::GRASS, 1.0, 1.0, 1.0);

		//Right boundary
		this->CreatePlatform(Vector3D(-50, 365, 0), 1, 1, Platform::LAMP, 1.0, 1.0, 1.0);

		//AI
		this->CreatePlatform(Vector3D(400, 460, 0), 1, 1, Platform::AISPAWNPOINT, 1.0, 1.0, 1.0);

		//Stairs up
		this->CreatePlatform(Vector3D(800, 460, 0), 1, 1, Platform::GRASS, 1.0, 1.0, 1.0);
		this->CreatePlatform(Vector3D(920, 420, 0), 1, 1, Platform::GRASS, 1.0, 1.0, 1.0);
		
		// BASEMENT 1 //

		//Basement 1 floor
		this->CreatePlatform(Vector3D(500, 625, 0), 15, 1, Platform::GRASS, 1.0, 1.0, 1.0);

		//Trees right boundary
		this->CreatePlatform(Vector3D(500, 545, 0), 3, 1, Platform::TREE, 1.0, 1.0, 1.0);
		this->CreatePlatform(Vector3D(530, 545, 0), 3, 1, Platform::TREE, 1.0, 1.0, 1.0);

		//AI
		this->CreatePlatform(Vector3D(750, 587, 0), 1, 1, Platform::AISPAWNPOINT, 1.0, 1.0, 1.0);
		this->CreatePlatform(Vector3D(900, 587, 0), 1, 1, Platform::AISPAWNPOINT, 1.0, 1.0, 1.0);
		this->CreatePlatform(Vector3D(1150, 587, 0), 1, 1, Platform::AISPAWNPOINT, 1.0, 1.0, 1.0);

		//Hay
		//1st row
		this->CreatePlatform(Vector3D(1233, 590, 0), 1, 1, Platform::HAY, 1.0, 1.0, 1.0);
		this->CreatePlatform(Vector3D(1233, 555, 0), 1, 1, Platform::HAY, 1.0, 1.0, 1.0);
		this->CreatePlatform(Vector3D(1233, 520, 0), 1, 1, Platform::HAY, 1.0, 1.0, 1.0);
		this->CreatePlatform(Vector3D(1233, 485, 0), 1, 1, Platform::HAY, 1.0, 1.0, 1.0);
		this->CreatePlatform(Vector3D(1233, 450, 0), 1, 1, Platform::HAY, 1.0, 1.0, 1.0);
		this->CreatePlatform(Vector3D(1233, 415, 0), 1, 1, Platform::HAY, 1.0, 1.0, 1.0);
		this->CreatePlatform(Vector3D(1233, 380, 0), 1, 1, Platform::HAY, 1.0, 1.0, 1.0);

		//2nd row
		this->CreatePlatform(Vector3D(1298, 590, 0), 1, 1, Platform::HAY, 1.0, 1.0, 1.0);
		this->CreatePlatform(Vector3D(1298, 555, 0), 1, 1, Platform::HAY, 1.0, 1.0, 1.0);
		this->CreatePlatform(Vector3D(1298, 520, 0), 1, 1, Platform::HAY, 1.0, 1.0, 1.0);
		this->CreatePlatform(Vector3D(1298, 485, 0), 1, 1, Platform::HAY, 1.0, 1.0, 1.0);
		this->CreatePlatform(Vector3D(1298, 450, 0), 1, 1, Platform::HAY, 1.0, 1.0, 1.0);
		this->CreatePlatform(Vector3D(1298, 415, 0), 1, 1, Platform::HAY, 1.0, 1.0, 1.0);
		this->CreatePlatform(Vector3D(1298, 380, 0), 1, 1, Platform::HAY, 1.0, 1.0, 1.0);

		//Right boundary
		this->CreatePlatform(Vector3D(1370, 587, 0), 1, 6, Platform::BOUNDARY, 1.0, 1.0, 1.0);

		// 2nd FLOOR //
		//Left floor
		this->CreatePlatform(Vector3D(1025, 380, 0), 3, 1, Platform::GRASS, 1.0, 1.0, 1.0);

		//Right floor
		this->CreatePlatform(Vector3D(1363, 380, 0), 6, 1, Platform::GRASS, 1.0, 1.0, 1.0);
		//AI
		this->CreatePlatform(Vector3D(1450, 340, 0), 1, 1, Platform::AISPAWNPOINT, 1.0, 1.0, 1.0);
		this->CreatePlatform(Vector3D(1700, 340, 0), 1, 1, Platform::AISPAWNPOINT, 1.0, 1.0, 1.0);

		//Stairs
		this->CreatePlatform(Vector3D(1800, 340, 0), 1, 1, Platform::GRASS, 1.0, 1.0, 1.0);

		// 3rd FLOOR //
		//Floor
		this->CreatePlatform(Vector3D(1900, 300, 0), 6, 1, Platform::GRASS, 1.0, 1.0, 1.0);

		//AI
		this->CreatePlatform(Vector3D(2050, 260, 0), 1, 1, Platform::AISPAWNPOINT, 1.0, 1.0, 1.0);

		//Lamp
		this->CreatePlatform(Vector3D(2200, 165, 0), 1, 1, Platform::LAMP, 1.0, 1.0, 1.0);

		// First Floor //
		//lamp
		this->CreatePlatform(Vector3D(1660, 415, 0), 1, 1, Platform::LAMP, 1.0, 1.0, 1.0);

		//floor
		this->CreatePlatform(Vector3D(1600, 530, 0), 6, 1, Platform::GRASS, 1.0, 1.0, 1.0);

		//AI
		this->CreatePlatform(Vector3D(1900, 490, 0), 1, 1, Platform::AISPAWNPOINT, 1.0, 1.0, 1.0);

		//Stairs
		this->CreatePlatform(Vector3D(2100, 590, 0), 1, 1, Platform::GRASS, 1.0, 1.0, 1.0);
		this->CreatePlatform(Vector3D(1950, 650, 0), 1, 1, Platform::GRASS, 1.0, 1.0, 1.0);
		this->CreatePlatform(Vector3D(2100, 710, 0), 1, 1, Platform::GRASS, 1.0, 1.0, 1.0);
		this->CreatePlatform(Vector3D(1950, 770, 0), 1, 1, Platform::GRASS, 1.0, 1.0, 1.0);

		//Basement 2//
		this->CreatePlatform(Vector3D(0, 835, 0), 41, 1, Platform::GRASS, 1.0, 1.0, 1.0);

		//lamp
		this->CreatePlatform(Vector3D(2300, 700, 0), 1, 1, Platform::LAMP, 1.0, 1.0, 1.0);

		//Right boundary
		this->CreatePlatform(Vector3D(2300, 660, 0), 1, 5, Platform::BOUNDARY, 1.0, 1.0, 1.0);

		//Hay
		this->CreatePlatform(Vector3D(1300, 800, 0), 1, 1, Platform::HAY, 1.0, 1.0, 1.0);
		this->CreatePlatform(Vector3D(1350, 800, 0), 1, 1, Platform::HAY, 1.0, 1.0, 1.0);
		this->CreatePlatform(Vector3D(1400, 800, 0), 1, 1, Platform::HAY, 1.0, 1.0, 1.0);
		this->CreatePlatform(Vector3D(1300, 765, 0), 1, 1, Platform::HAY, 1.0, 1.0, 1.0);
		this->CreatePlatform(Vector3D(1350, 765, 0), 1, 1, Platform::HAY, 1.0, 1.0, 1.0);
		this->CreatePlatform(Vector3D(1400, 765, 0), 1, 1, Platform::HAY, 1.0, 1.0, 1.0);

		//floor
		this->CreatePlatform(Vector3D(715, 730, 0), 8, 1, Platform::GRASS, 1.0, 1.0, 1.0);
		
		//Trees
		this->CreatePlatform(Vector3D(750, 755, 0), 1, 1, Platform::TREE, 1.0, 1.0, 1.0);
		
		//Boundary if the level is not protect
		if (questType != Level::PROTECT)
		{
			this->CreatePlatform(Vector3D(750, 650, 0), 1, 1, Platform::TREE, 1.0, 1.0, 1.0);
		}

		//Special spawn
		this->CreatePlatform(Vector3D(300, 795, 0), 1, 1, Platform::SPECIALSPAWN, 1.0, 1.0, 1.0);
		this->CreatePlatform(Vector3D(700, 795, 0), 1, 1, Platform::SPECIALSPAWN, 1.0, 1.0, 1.0);

		//lamp
		this->CreatePlatform(Vector3D(200, 700, 0), 1, 1, Platform::LAMP, 1.0, 1.0, 1.0);

		Level::InitLevel(player, questType, difficulty);

		init = true;
	}
}

void Level2::RenderLevel(void)
{
	Level::RenderLevel();
}

bool Level2::UpdateLevel(float elapsed)
{
	return Level::UpdateLevel(elapsed);
}